//
//  TwERPUser.m
//  TwERP
//
//  Created by Xiangyang Li on 12-8-22.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "TwERPUser.h"
#import "TwERPJsonAgent.h"

@implementation TwERPUser
@synthesize userName = _userName;
@synthesize password = _password;
@synthesize loginName = _loginName;
@synthesize ckId = _ckId;
@synthesize departmentId = _departmentId;

+ (TwERPUser *) loginUser:(NSString *)loginName WithPassword:(NSString *)password
{
    TwERPUser * user =[[TwERPUser alloc] init];
   NSDictionary * jsonUser = [TwERPJsonAgent loginUser:loginName WithPassword:password];
    if (jsonUser != nil) {
        
        [user setValuesForKeysWithDictionary:jsonUser];
        [TwERPJsonAgent getCpHeader]; //prepare for offline creatting gongdan
        return user;
    }
    else
        return nil;
}

+ (TwERPUser *) demoUser;
{
    
    TwERPUser * user =[[TwERPUser alloc] init];
       user.userName=@"笛威欧亚";
     user.loginName=@"twinway";
     user.password=@"123";
     user.ckId=1;
     user.departmentId=1;
    user.entityId=2;
     return user;
   

}
@end
